<?php
/**
 * Created by JetBrains PhpStorm.
 * User: quangvu
 * Date: 5/25/13
 * Time: 10:04 AM
 * To change this template use File | Settings | File Templates.
 */

class Post {

    protected $title;
    protected $content;

    public function __construct($title=null, $content=null) {
        if(isset($title)) {
            $this->title = $title;
        }
        if(isset($content)) {
            $this->content = $content;
        }
    }

    public function setTitle($title) {
        $this->title = $title;
    }

    public function getTitle() {
        return $this->title;
    }

    public function setContent($content) {
        $this->content = $content;
    }

    public function getContent() {
        return $this->content;
    }

    public function toArray() {
        //return array('postTitle'=>$this->title, 'postContent'=>$this->content);
        $post = array();
        $post['postTitle'] = $this->title;
        $post['postContent'] = $this->content;
        return $post;
    }

    public function toHTML() {
        $html  = '<div class="postbox">';
        $html .=    '<h2>' .$this->title. '</h2>';
        $html .=    '<p class="post-content">'. $this->content . '</p>';
        $html .= '</div>';
        return $html;
    }
}